//时间戳转换
Vue.filter('timeToString', function (time, type) {
    if (time) {
        var newTime = new Date(time * 1000);
        var month = newTime.getMonth() + 1,
            date = newTime.getDate(),
            year = newTime.getFullYear(),
            hours = newTime.getHours(),
            minutes = newTime.getMinutes();
        if (date < 10) {
            date = '0' + date;
        }
        if (month < 10) {
            month = '0' + month;
        }
        if (hours < 10) {
            hours = '0' + hours
        }
        if (minutes < 10) {
            minutes = "0" + minutes
        }
        if (type === 'ymdhi') {
            return year + '-' + month + '-' + date + ' ' + hours + ':' + minutes
        } else if (type === 'ymd') {
            return year + '-' + month + '-' + date
        } else if (type === 'mdhi') {
            return month + '-' + date + '-' + hours + ':' + minutes
        } else if (type === 'ym') {
            return year + '-' +month
        } else if (type === 'md') {
            return month + '-' + date
        } else if (type === 'hi') {
            return hours + ':' + minutes
        }
    }
    return '时间';
});
